﻿using System;

namespace NetTopologySuite.Utilities
{
	public static class Assert
	{
		public static void IsTrue(bool assertion)
		{
			Assert.IsTrue(assertion, null);
		}

		public static void IsTrue(bool assertion, string message)
		{
			if (assertion)
			{
				return;
			}
			if (message == null)
			{
				throw new AssertionFailedException();
			}
			throw new AssertionFailedException(message);
		}

		public static void IsEquals(object expectedValue, object actualValue)
		{
			Assert.IsEquals(expectedValue, actualValue, null);
		}

		public static void IsEquals(object expectedValue, object actualValue, string message)
		{
			if (actualValue.Equals(expectedValue))
			{
				return;
			}
			string arg = (message != null) ? (": " + message) : string.Empty;
			throw new AssertionFailedException(string.Format("Expected {0} but encountered {1}{2}", expectedValue, actualValue, arg));
		}

		public static void ShouldNeverReachHere()
		{
			Assert.ShouldNeverReachHere(null);
		}

		public static void ShouldNeverReachHere(string message)
		{
			string arg = (message != null) ? (": " + message) : string.Empty;
			throw new AssertionFailedException(string.Format("Should never reach here{0}", arg));
		}
	}
}
